<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>图书列表</title>
  <style>
    .odd{
      background-color:#e7e7e7
    }
    .even{
      background-color:red
    }
  </style>
</head>
<body>
<table>
  <tr class="odd">
    <th>序号</th>
    <th>书名</th>
    <th>作者</th>
    <th>价格</th>
  </tr>
  {% for book in books %}
    <tr class="{{loop.cycle('odd','even')}}">
      <th>{{loop.index}}</th>
      <td>{{book.name}}</td>
      <td>{{book.author}}</td>
      <td>{{book.price}}</td>
    </tr>
  {% else %}
    <tr>
      <td style="text-align:center;">暂无数据!</td>
    </tr>
  {% endfor %}
</table>
</body>
</html>